<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: xwj32
  Date: 2023-05-08
  Time: 22:12
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.2/dist/css/bootstrap.min.css" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.2/dist/js/bootstrap.bundle.min.js"></script>
    <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
    <title>Document</title>
    <style>
        body{
            background-image: url("/images/background-img/leaves.png");
        }

        #container{
            border: 1px solid black;
        }
    </style>


</head>
<body>

<div>
<div class="container mt-3" id="container">
    <h2><img src="${pageContext.request.contextPath}/images/img/用户管理.png" alt="">
        用户信息管理系统</h2>
    <table class="table table-striped">
        <thead>
        <tr>
            <th>姓名</th>
            <th>电话号码</th>
            <th>密码</th>
            <th colspan="2">操作</th>
        </tr>
        </thead>

        <tbody>
        <c:forEach items="${requestScope.customers}" var="customer">
            <tr>
                <td>${customer.name}</td>
                <td>${customer.phoneNumber}</td>
                <td>${customer.password}</td>
                <td><a class="deleteClass btn btn-success" href="http://localhost:8080/Hospital_line_call_system_war/CustomerMangerServlet?action=delete&pid=${customer.pid}">删除</a></td>
                <td><a class="btn btn-success" href="http://localhost:8080/Hospital_line_call_system_war/CustomerMangerServlet?action=getCustomer&pid=${customer.pid}">修改</a></td>
            </tr>
        </c:forEach>
        <tr>
            <td></td>
            <td></td>
            <td></td>
            <td><a href=""></a></td>
            <td><a class="btn btn-primary" href="http://localhost:8080/Hospital_line_call_system_war/manager/Addcustomer.jsp">增加</a></td>
        </tr>
        </tbody>
    </table>
</div>
</div>
<script type="text/javascript">
    //confirm是确认提示框函数
    //返回true表示点击确认
    $(function (){
        $("a.deleteClass").click(function (){
            return  confirm("你确定要删除【"+$(this).parent().parent().find("td:first").text()+"用户吗"+"】");
        })
    });
</script>
</body>
</html>
